
class Employee {
    private String name;
    private int age;

    /**
     * 构造器
     * @param string
     * @param i
     */
    public Employee(String string, int i) {
        this.name = string;
        this.age = i;
    }

    public static void swap(Employee x, Employee y) {
        /**
         * 交换两个里的内容
         */
        Employee tmp = new Employee("", 0);
        tmp.setName(x.getName());
        tmp.setAge(x.getAge());

        x.setName(y.getName());
        x.setAge(y.getAge());

        y.setName(tmp.getName());
        y.setAge(tmp.getAge());        

        /**
         * 对象引用传值，但是直接交换了两个引用，对象的数值没有改变，实际上还是值传递
         */

        Employee tem = x;
        x = y;
        y = tem;

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
